package com.hyfrogx.modules.information.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hyfrogx.modules.information.dao.InfoSourceDao;
import com.hyfrogx.modules.information.entity.InfoSource;
import com.hyfrogx.modules.information.service.InfoSourceServie;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author liubin
 * @date 2019/11/1 10:23
 */
@Slf4j
@Service("InfoSourceServie")
public class InfoSourceServieImpl extends ServiceImpl<InfoSourceDao, InfoSource> implements InfoSourceServie {
  @Override
  public List<Integer> getapkById(Integer id) {
    return this.baseMapper.getapkById(id);
  }

  @Override
  public void put(Integer id, Integer[] channelIds) {
    Integer num=this.baseMapper.selectCount(new QueryWrapper<InfoSource>().eq("id",id));
    if(num>0){
      this.baseMapper.deleteById(id);
    }
    this.baseMapper.inserts(id,channelIds);

  }
}
